package daohibernate;

import hibernate.HibernateUtil;
import negocio.beans.oficinaventa.Factura;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class FacturaDAO {
	private static FacturaDAO instancia = null;
	private static SessionFactory sf = null;	
	
	public static FacturaDAO getInstancia(){
		if(instancia == null){
			sf = HibernateUtil.getSessionFactory();
			instancia = new FacturaDAO();
		} 
		return instancia;
	}
	
	
	public void grabarFactura(Factura f){
		Session s = sf.openSession();
		s.beginTransaction();	
				
		s.persist(f);
				
		s.flush();
		s.getTransaction().commit();
	}
}
